import { uniqueId } from 'lodash'

/**
 * @description 给菜单数据补充上 path 字段
 * @description https://github.com/d2-projects/d2-admin/issues/209
 * @param {Array} menu 原始的菜单数据
 */
function supplementPath (menu) {
  return menu.map(e => ({
    ...e,
    path: e.path || uniqueId('d2-menu-empty-'),
    ...e.children ? {
      children: supplementPath(e.children)
    } : {}
  }))
}

export const menuHeader = supplementPath([
  { path: '/index', title: '首页', icon: 'home' },
  {
    title: '客户管理',
    icon: 'folder-o',
    children: [
      { path: '/userInfo', title: '客户信息' },

    ]
  },
  {
    title: '店铺管理',
    icon: 'folder-o',
    children: [
      { path: '/shopInfo', title: '店铺信息' },
      { path: '/shopExamine', title: '店铺审核' },
      // { path: '/shopCommodity', title: '商品管理' },
      { path: '/shopAccount', title: '店铺账号管理' },
      { path: '/shopType', title: '店铺类型' },
    ]
  },
  {
    title: '配送员管理',
    icon: 'folder-o',
    children: [
      { path: '/deliveryInfo', title: '配送员管理' },
      { path: '/deliveryExamine' , title: '配送员审核'}
    ]
  },
  {
    title: '订单管理',
    icon: 'folder-o',
    children: [
      // { path: '/orderIntegral', title: '积分订单' },
      { path: '/orderTakeaway', title: '外卖订单' },
    ]
  },
  {
    title: '财务管理',
    icon: 'folder-o',
    children: [
      { path: '/flowBusiness', title: '业务流水' },
      { path: '/flowMoney', title: '金额流水' },
    ]
  },
  {
    title: '系统管理',
    icon: 'folder-o',
    children: [
      { path: '/comSchool', title: '校园管理' },
      { path: '/comSchoolBuilding', title: '校园楼栋管理' },
      // { path: '/comAdmin', title: '管理员管理' },
      // { path: '/comRole', title: '角色管理' },
      // { path: '/banner', title: '系统图管理' },
      // { path: '/comFeedback', title: '反馈管理' },
      { path: '/systemItem', title: '系统变量管理' },
      { path: '/comDistributionRule', title: '分销商等级规则管理' },
    ]
  },
  // {
  //   title: '积分商品管理',
  //   icon: 'folder-o',
  //   children: [
  //     { path: '/integralCommodity', title: '积分商品管理' },
  //     { path: '/integralCommodityType', title: '积分商品类型管理' },
  //     { path: '/integralExchange', title: '积分兑换管理' },
  //   ]
  // }
])

export const menuAside = supplementPath([
  { path: '/index', title: '首页', icon: 'home' },
  {
    title: '客户管理',
    icon: 'folder-o',
    children: [
      { path: '/userInfo', title: '客户信息' },

    ]
  },
  {
    title: '店铺管理',
    icon: 'folder-o',
    children: [
      { path: '/shopInfo', title: '店铺信息' },
      { path: '/shopExamine', title: '店铺审核' },
      // { path: '/shopCommodity', title: '商品管理' },
      { path: '/shopAccount', title: '店铺账号管理' },
      { path: '/shopType', title: '店铺类型' },
      
    ]
  },
  {
    title: '配送员管理',
    icon: 'folder-o',
    children: [
      { path: '/deliveryInfo', title: '配送员管理' },
      { path: '/deliveryExamine' , title: '配送员审核'}
    ]
  },
  {
    title: '订单管理',
    icon: 'folder-o',
    children: [
      // { path: '/orderIntegral', title: '积分订单' },
      { path: '/orderTakeaway', title: '外卖订单' },
    ]
  },
  {
    title: '财务管理',
    icon: 'folder-o',
    children: [
      { path: '/flowBusiness', title: '业务流水' },
      { path: '/flowMoney', title: '金额流水' },
    ]
  },
  {
    title: '系统管理',
    icon: 'folder-o',
    children: [
      { path: '/comSchool', title: '校园管理' },
      { path: '/comSchoolBuilding', title: '校园楼栋管理' },
      // { path: '/comAdmin', title: '管理员管理' },
      // { path: '/comRole', title: '角色管理' },
      // { path: '/banner', title: '系统图管理' },
      // { path: '/comFeedback', title: '反馈管理' },
      { path: '/systemItem', title: '系统变量管理' },
      { path: '/comDistributionRule', title: '分销商等级规则管理' },
    ]
  },
  // {
  //   title: '积分商品管理',
  //   icon: 'folder-o',
  //   children: [
  //     { path: '/integralCommodity', title: '积分商品管理' },
  //     { path: '/integralCommodityType', title: '积分商品类型管理' },
  //     { path: '/integralExchange', title: '积分兑换管理' },
  //   ]
  // }
])
